package com.tencet.servlet;

import com.tencet.service.Impl.UserServiceImpl;
import com.tencet.service.UserService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author: aiming    @date: 2022/7/21 10:06
 * @description:
 */
@WebServlet("/check")
public class CheckPhoneServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //接收电话号码
        String phoneNum = req.getParameter("phoneNum");
        //String password = req.getParameter("password");
        //调用service
        UserService userService = new UserServiceImpl();
        boolean result = userService.check(phoneNum);
//        userService.check(phoneNum);


        //写回到页面
        resp.getWriter().write(result + "");

        //把手机号传到session   req.getSession().setAttribute("phone_num",phone_num);
    }
}
